package com.ruoyi.apis.vo;

import com.ruoyi.apis.entity.OfflineEntity;
import com.ruoyi.apis.entity.OnlineEntity;
import com.ruoyi.apis.utils.ResponseUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeanUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author Choi
 * @Date 2021/7/19
 */

@Setter
@Getter
public class OfflineVO {
    private Long id;
    private String title;
    private String image;
    private String intro;
    private String description;
    private String[] images;

    public OfflineVO(OfflineEntity offline) {
        BeanUtils.copyProperties(offline, this);
        this.images = ResponseUtils.getImages(offline.getImages());
    }

    public static List<OfflineVO> getOfflineList(List<OfflineEntity> offlines) {
        return offlines.stream()
                .map(OfflineVO::new)
                .collect(Collectors.toList());
    }


}
